import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_jd/ui/widgets/kit.dart';
import 'package:get/route_manager.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

// 路由面板
class RoutePanel extends GetWidget {
  final List list;

  RoutePanel({required this.list});

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(top: 12.h),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(15.r),
      ),
      child: Column(
        children: List.generate(
          list.length,
          (index) => GestureDetector(
            onTap: () {
              String page = list[index]['page'];
              if (page != '') {
                Get.toNamed(page);
              }
            },
            child: Container(
              height: 50.h,
              padding: EdgeInsets.only(left: 12.w, right: 12.w),
              decoration: BoxDecoration(
                border: Border(
                  bottom: BorderSide(
                    color: list.length != index
                        ? Color(0xFFF8F8F8)
                        : Colors.transparent,
                    width: 1,
                  ),
                ),
              ),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    list[index]['name'],
                    style: TextStyle(fontSize: 15.sp),
                  ),
                  Kit.iconFont(0xe7e7, Color(0xFF888888), 14.sp)
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
